﻿Public Class clCasillaInterruptor : Inherits clCasilla : Implements IEquatable(Of clCasillaInterruptor)

    Public Event ActivarCasilla(ByVal sender As clCasilla, ByVal e As EventArgs)
    Public Sub New(ByVal objeto As Control)
        MyBase.New(ElSuelo.Accesible, objeto)
        ImagenPredeterminada = My.Resources.interruptor
        _Activado = False
    End Sub
    Protected _Activado As Boolean
    Public Overridable Property Activado As Boolean
        Get
            Return _Activado
        End Get
        Set(ByVal value As Boolean)
            _Activado = value
            If value Then
                RaiseEvent ActivarCasilla(Me, New EventArgs)
            End If

        End Set
    End Property
    Public Sub Pisar(ByVal heroe As clHeroe)
        If heroe.ControlDelHeroe.Control.Location = Me.Control.Location Then
            RaiseEvent ActivarCasilla(Me, New EventArgs)
        End If
    End Sub
    Public Overloads Function Equals(ByVal Interruptor As clCasillaInterruptor) As Boolean Implements System.IEquatable(Of clCasillaInterruptor).Equals
        Return clCasilla.Equals(Me, Interruptor)
    End Function
    Public Overloads Shared Function Equals(ByVal InterruptorA As clCasillaInterruptor, ByVal InterruptorB As clCasillaInterruptor) As Boolean
        Return InterruptorA.GetType = InterruptorB.GetType And InterruptorA.Control.Name = InterruptorB.Control.Name
    End Function
 
End Class
